package org.example.LeetCode;

import java.util.Arrays;


public class leetCode_455 {
    public static void main(String[] args) {
        int[] g = {3, 2, 1};
        int[] s = {1, 4, 3, 2};
        int children = findContentChildren(g, s);
        System.out.println(children);
    }

    public static int findContentChildren(int[] g, int[] s) {
        Arrays.sort(g);
        Arrays.sort(s);
        int count = 0;
        for (int si : s) {
            if (count < g.length && g[count] <= si){
                count++;
            }
        }
        return count;

    }
}
